package cn.worldyao.demo.controller;


import cn.worldyao.demo.entity.SysUser;
import cn.worldyao.demo.service.SysUserService;
import cn.worldyao.demo.util.ReturnSet;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.sql.ResultSet;
import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author yaozi
 * @since 2020-03-11
 */
@RestController
@RequestMapping("/sys-user")
public class SysUserController {

    @Autowired
    private SysUserService sysUserService;

    @GetMapping("list")
    public ReturnSet UserList() {
        QueryWrapper queryWrapper = new QueryWrapper();
//        queryWrapper.
        List<SysUser> products = sysUserService.list();
        JSONArray array = JSONArray.parseArray(JSON.toJSONString(products));
        System.out.println(array);
        return ReturnSet.success(array);
    }

}
